package listbyorder.access001_100.test62;

/**
 * @author code_yc
 * @version 1.0
 * @date 2020/6/3 10:29
 */
public class Solution1 {

    // 方法一；递归（超时）
    public int uniquePaths(int m, int n) {
        return dfs(0,0,m-1,n-1);
    }

    private int dfs(int sr, int sc, int er, int ec) {
        if(sr == er || sc == ec) return 1;
        return dfs(sr + 1, sc, er, ec) + dfs(sr, sc + 1, er, ec);   // 向下走和向右走累加
    }
}
